package com.hit.server.api.type;

import java.util.Map;
import java.util.stream.Collectors;
import java.util.stream.Stream;

/**
 * 告警类型
 *
 * @author kehanjiang
 * @date 2023/09/15
 */
public enum WarningTypeEnums {
    SYSTEM("0", "设备告警"),
    EQUIPMENT("1", "检测告警");

    private String code;

    private String desc;

    WarningTypeEnums(String code, String desc) {
        this.code = code;
        this.desc = desc;
    }

    public String getCode() {
        return code;
    }

    public void setCode(String code) {
        this.code = code;
    }

    public String getDesc() {
        return desc;
    }

    public void setDesc(String desc) {
        this.desc = desc;
    }

    private static final Map<String, WarningTypeEnums> MAP = Stream.of(WarningTypeEnums.values()).collect(Collectors.toMap(WarningTypeEnums::getCode, v -> v));

    public static WarningTypeEnums getByCode(String code) {
        return MAP.get(code);
    }
}
